<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2022/1/17
 * Time: 14:17
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

declare(strict_types=1);

namespace app\common\lib;

class Show
{
    /**
     * @param int $code
     * @param string $msg
     * @param array $data
     * @param int $httpCode
     * @return \think\response\Json
     */
    public static function json_show(int $code = 1, string $msg = "ok", array $data = [], $httpCode = 200)
    {
        $result = [
            "code" => $code,
            "msg" => $msg,
            "data" => $data
        ];
        return json($result, $httpCode);
    }

    /**
     * @param array $data
     * @return false|string
     */
    public static function json_encode(array $data = [])
    {
        return json_encode($data, JSON_UNESCAPED_UNICODE);
    }
}